//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#ifndef _ListAncestorMol_H
#define	_ListAncestorMol_H
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "AncestorMol.h"
#include "MatrixTool.h"
#include "libraries.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
class ListAncestorMol {
  
  private:

    String*                filenameAncestor;
    
    TListE <AncestorMol>*  listAncestor;
    
    MatrixTool*            similarityMatrix;
    
  protected:

    void                  CenterListByMatrix(TListE <AncestorMol>*, String*); 
    void                  ListOriginalAncestor(TListE <AncestorMol>*, TListE <AncestorMol>*, int);
    
    bool                  SplitColumn(char*, TListE <String>*, char*);
    bool                  SplitColumn(char*, TListE <String>*, const char*);
    
  public:
    
    ListAncestorMol();
    ListAncestorMol(String*);
    ListAncestorMol(ListAncestorMol&);
    ListAncestorMol(ListAncestorMol*);

    ~ListAncestorMol();

    void                  FilenameAncestor(String*);
    void                  FilenameAncestor(char*);
    void                  ListAncestor(TListE <AncestorMol>*);
    void                  MatrixSimilarity(MatrixTool*);
    
    String*               FilenameAncestor(void);
    TListE <AncestorMol>* ListAncestor(void);
    MatrixTool*           MatrixSimilarity(void);
    
    bool                  SetListAncestor(TListE <String>* listAncestor);
    
    bool                  LoadDataAncestorFiles(void);
    bool                  LoadDataAncestorFilesFrom(long, long);
    
    bool                  AddAncestorFromFile(String*, int);

    bool                  WriteAncestorFile(void);
    bool                  WriteAncestorFileFrom(long, long);

    bool                  OrderListByAncestorCenteredMatrixIterative(void);
    bool                  OrderListByAncestorDescendentIterative(void);
    bool                  OrderListByAncestorAscendentIterative(void);
    bool                  OrderListByAncestorCenteredMatrixIterativeX(void);

    bool                  OrderListByAncestorDescendent(void);
    bool                  OrderListByAncestorAscendent(void);
    bool                  OrderListByAncestorCentered(void);
    
    bool                  GetAncestorByLevel(TListE <String>*, int);

    double                ComputeConvergenceAncestorFile(String*);
    double                ComputeConvergenceClusterSim(String*);

    double                ComputeSumConvergenceAncestorFile(String*, long&);
    double                ComputeSumConvergenceClusterSim(String*, double&, double&);

    double                ComputeClusterSimilarity(String*, int, int);
    
    ListAncestorMol       operator=(ListAncestorMol&);

};
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#endif	
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
